#ifndef QWCOMBBOXDELEGATE_H
#define QWCOMBBOXDELEGATE_H

#include<QObject>
#include<QStyledItemDelegate>
#include<QStringList>

class QWCombBoxDelegate : public QStyledItemDelegate
{
    Q_OBJECT
public:
    explicit QWCombBoxDelegate(QStyledItemDelegate *parent = nullptr) ;
protected:
    QWidget *createEditor(QWidget *parent,
                                  const QStyleOptionViewItem &option,
                                  const QModelIndex &index) const override;
    void setEditorData(QWidget *editor, const QModelIndex &index) const override;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
    void updateEditorGeometry(QWidget *editor,
                              const QStyleOptionViewItem &option,
                              const QModelIndex &index) const override;

public:
    void setItems(QStringList strList,bool bEdit);

private:
    // 选择列表
    QStringList m_strItems;
    // 是否可编辑
    bool m_bEdit;

signals:
};

#endif // QWCOMBBOXDELEGATE_H
